<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <ul>
        {% for book in books %}
            <li>{{ book }}</li>
        {% endfor %}
    </ul>

    <ul>
        {% for key in person.keys %}
            <li>{{ key }}</li>
        {% endfor %}
    </ul>

    <ul>
        {% for value in person.values %}
            <li>{{ value }}</li>
        {% endfor %}
    </ul>

    <ul>
        {% for key,value in person.items %}
            <li>{{ key }}->{{ value }}</li>
        {% endfor %}
    </ul>

    <table>
        <thead>
            <tr>
                <td>序号</td>
                <td>书名</td>
                <td>作者</td>
                <td>价格</td>
            </tr>
        </thead>
        <tbody>
            {% for book in books %}
                <tr>
                    {# forloop.counter 从1开始,遍历序号正序 #}
                    {# forloop.counter0 从0开始,遍历序号正序 #}
                    <td>{{ forloop.counter }}</td>
                    <td>{{ book.name }}</td>
                    <td>{{ book.author }}</td>
                    <td>{{ book.price }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <br>
    <table>
        <thead>
            <tr>
                <td>序号</td>
                <td>书名</td>
                <td>作者</td>
                <td>价格</td>
            </tr>
        </thead>
        <tbody>
            {% for book in books %}
                <tr>
                    {# forloop.revcounter 从1开始,遍历序号倒叙 #}
                    {# forloop.revcounter0 从0开始,遍历序号倒叙 #}
                    <td>{{ forloop.revcounter }}</td>
                    <td>{{ book.name }}</td>
                    <td>{{ book.author }}</td>
                    <td>{{ book.price }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <br>
    <table>
        <thead>
            <tr style="background: green">
                <td>序号</td>
                <td>书名</td>
                <td>作者</td>
                <td>价格</td>
            </tr>
        </thead>
        <tbody>
            {% for book in books %}
                {% if forloop.first %}
                    <tr style="background: red">
                {% elif forloop.last %}
                    <tr style="background: pink">
                {% else %}
                    <tr>
                {% endif %}
                    <td>{{ forloop.counter }}</td>
                    <td>{{ book.name }}</td>
                    <td>{{ book.author }}</td>
                    <td>{{ book.price }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    <ul>
        {% for comment in comments %}
            <li>{{ comment }}</li>
        {% empty %}
            <li>没有任何评论</li>
        {% endfor %}
    </ul>

    <ul>
        {% for data in datas %}
            <li>{{ data }}</li>
        {% empty %}
            <li>没有任何评论</li>
        {% endfor %}
    </ul>

    <button onclick="copyText()">自动生成IMEI</button>

    <input type="text" name="fname">aaa</input>

    {{ 1 | add:2 }}

    <p>aaaaaaa {{ imei }}</p>
{#    <p>aaaaaaa {%  %}</p>#}

{#    <a href="for_demo1/">点我</a>#}

</body>
</html>